package hxm.core;

import haxe.macro.Expr;

import hxm.monads.OptionMonad;

/**
 * ...
 * @author Simon Krajewski
 */

#if macro
 
enum MExprBase<T> 
{
	MBind(ident:T, bind:T, inner:T);
	MReturn(?value:T);
	MExpr(expr:Expr);
	MBlock(exprs:Array<T>);
	MSub(expr:T);
	MType(type:T);
	MCall(expr:T, params:Array<T>, inner:T);
}

typedef MExpr =
{
	expr: MExprBase<MExpr>,
	pos: haxe.macro.Position
}

typedef TMExpr =
{
	expr: MExprBase<TMExpr>,
	pos: haxe.macro.Position,
	type: Option<TypeInfo>
}

typedef TypeInfo =
{
	name:String,
	subtype:Option<TypeInfo>,
	neutral:Dynamic
}

typedef MonadicClass =
{
	path: String,
	type: haxe.macro.Type
}

typedef MonadicContext =
{
	type:Option<TypeInfo>,
	idents:Hash<Dynamic>
}

#end